package com.ruoyi.slope.info.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.slope.info.mapper.SlopeInfoMapper;
import com.ruoyi.slope.info.domain.SlopeInfo;
import com.ruoyi.slope.info.service.ISlopeInfoService;

/**
 * 边坡信息Service业务层处理
 * 
 * @author psy
 * @date 2025-05-10
 */
@Service
public class SlopeInfoServiceImpl implements ISlopeInfoService 
{
    @Autowired
    private SlopeInfoMapper slopeInfoMapper;

    /**
     * 查询边坡信息
     * 
     * @param id 边坡信息主键
     * @return 边坡信息
     */
    @Override
    public SlopeInfo selectSlopeInfoById(Long id)
    {
        return slopeInfoMapper.selectSlopeInfoById(id);
    }

    /**
     * 查询边坡信息列表
     * 
     * @param slopeInfo 边坡信息
     * @return 边坡信息
     */
    @DataScope(deptAlias = "s")
    @Override
    public List<SlopeInfo> selectSlopeInfoList(SlopeInfo slopeInfo)
    {
        return slopeInfoMapper.selectSlopeInfoList(slopeInfo);
    }

    /**
     * 查询边坡编码列表
     *
     * @param slopeInfo 边坡信息
     * @return 边坡编码集合
     */
    @DataScope(deptAlias = "s")
    @Override
    public Map<String,String> selectSlopeCodeList(SlopeInfo slopeInfo){
        List<SlopeInfo> slopeCode = slopeInfoMapper.selectSlopeCodeList(slopeInfo);
        HashMap<String,String> map = new HashMap<String,String>();
        for (SlopeInfo info : slopeCode) {
            map.put(info.getSlopeName(), info.getSlopeCode());
        }
        return map;
    }

    /**
     * 新增边坡信息
     * 
     * @param slopeInfo 边坡信息
     * @return 结果
     */
    @Override
    public int insertSlopeInfo(SlopeInfo slopeInfo)
    {
        return slopeInfoMapper.insertSlopeInfo(slopeInfo);
    }

    /**
     * 修改边坡信息
     * 
     * @param slopeInfo 边坡信息
     * @return 结果
     */
    @Override
    public int updateSlopeInfo(SlopeInfo slopeInfo)
    {
        slopeInfo.setUpdateTime(DateUtils.getNowDate());
        return slopeInfoMapper.updateSlopeInfo(slopeInfo);
    }

    /**
     * 批量删除边坡信息
     * 
     * @param ids 需要删除的边坡信息主键
     * @return 结果
     */
    @Override
    public int deleteSlopeInfoByIds(Long[] ids)
    {
        return slopeInfoMapper.deleteSlopeInfoByIds(ids);
    }

    /**
     * 删除边坡信息信息
     * 
     * @param id 边坡信息主键
     * @return 结果
     */
    @Override
    public int deleteSlopeInfoById(Long id)
    {
        return slopeInfoMapper.deleteSlopeInfoById(id);
    }
}
